<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title></title>
    <script>

        var url = window.location.href;
        var timestamp3 = new Date().getTime();

        Ajax("get","http://yun1.jzwebsite.cn/bargain/id.php",{},function (data) {
            if(data == 1 || data == 3) {
                // alert(url.indexOf("noval"));
                if (url.indexOf("noval") != -1) {
                    Ajax("get", "http://yun1.jzwebsite.cn/bargain/advert.php", {}, function (data) {
                        // alert(data);
                        window.location.href = 'http://' + data + "/noval1.html";
                    })
                } else if (url.indexOf("skip") != -1) {
                    Ajax('get', 'http://yunxianggang.jzwebsite.cn/bargain/fall.php', {acti_id: 3}, function (data) {
                        window.location.href = "http://" + data + "/money.html?acti_id=3";
                    }, function (error) {
                    });
                } else {
                    Ajax('get', 'http://yun1.jzwebsite.cn/bargain/fall.php', {acti_id: 3}, function (data) {
                        window.location.href = "http://" + data + "/money.html?acti_id=3";
                    }, function (error) {
                    });
                }
            }else{
                Ajax('get', 'http://yunxianggang.jzwebsite.cn/bargain/fall.php', {acti_id: 3}, function (data) {
                    window.location.href = "http://" + data + "/money.html?acti_id=3";
                }, function (error) {
                });
            }
        })

        /**
         * 封装的ajax
         * @param type
         * @param url
         * @param data
         * @param success
         * @param failed
         * @constructor
         */
        function Ajax(type, url, data, success, failed){
            // 创建ajax对象
            var xhr = null;
            if(window.XMLHttpRequest){
                xhr = new XMLHttpRequest();
            } else {
                xhr = new ActiveXObject('Microsoft.XMLHTTP')
            }

            var type = type.toUpperCase();
            // 用于清除缓存
            var random = Math.random();

            if(typeof data == 'object'){
                var str = '';
                for(var key in data){
                    str += key+'='+data[key]+'&';
                }
                data = str.replace(/&$/, '');
            }

            if(type == 'GET'){
                if(data){
                    xhr.open('GET', url + '?' + data, true);
                } else {
                    xhr.open('GET', url + '?t=' + random, true);
                }
                xhr.send();

            } else if(type == 'POST'){
                xhr.open('POST', url, false);
                // 如果需要像 html 表单那样 POST 数据，请使用 setRequestHeader() 来添加 http 头。
                xhr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
                xhr.send(data);
            }

            // 处理返回数据
            xhr.onreadystatechange = function(){
                if(xhr.readyState == 4){
                    if(xhr.status == 200){
                        success(xhr.responseText);
                    } else {
                        if(failed){
                            failed(xhr.status);
                        }
                    }
                }
            }
        }
    </script>
</head>
<body>

</body>
</html>